﻿using System.Collections.Generic;
using System.Linq;
using CRM.Models.SocialMarketing;

namespace CRM.ViewModels.Social
{
    public class SocialMarketingTaskAddVm
    {
        public int Id { get; set; }
        
        public string Name { get; set; }
        public string Content { get; set; }
        
        public string ImagesStr { get; set; }
        public List<string> Images { get => ImagesStr?.Split(',').ToList();
            set => ImagesStr = string.Join(',', value);
        }

        public SocialMarketingTask NewModel()
        {
            return new() {Name = Name, Content = Content, ImagesStr = ImagesStr};
        }
        
        public SocialMarketingTask EditModel(SocialMarketingTask task)
        {
            task.Name = Name;
            task.Content = Content;
            task.ImagesStr = ImagesStr;
            return task;
        }
    }
}